<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.prime.com.tr/ui">

    <ui:composition template="/template/DefaultTemplate.xhtml">
        <ui:define name="content">
            <f:view contentType="text/html">
                <h:form rendered="#{loginBacking.viewSalesOrder}">
                    <p:tabView effect="opacity" effectDuration="normal" dynamic="false" cache="true"> 

                        <p:messages />
                        <br />
                        <p:tab title="Sales Order Detail" >                       
                            <ui:include src="/entities/salesOrderEntity/ViewSO.xhtml" />
                            <ui:include src="/entities/salesOrderEntity/ViewMetaInfo.xhtml" />
                        </p:tab>
                        <p:tab title="Purchase Order" >              
                            <ui:include src="/entities/purchaseOrderEntity/ViewToBeIncluded.xhtml" />
                        </p:tab>
                        <p:tab title="Shipping Information" > 
                            <ui:include src="/entities/shippingRequestEntity/ListShippingRequests.xhtml" />
                            <ui:include src="/entities/shippingOrderEntity/ListForSOForInclude.xhtml" />
                        </p:tab>
                        <p:tab title="Credit Payment" > 
                            <ui:include src="/entities/salesOrderEntity/ViewCreditPayment.xhtml" />
                            <ui:include src="/entities/billingRequestEntity/ListToBeIncluded.xhtml" />
                        </p:tab>                                        

                    </p:tabView>
                    <br />
                    <p:commandButton ajax="false" action="#{salesOrderEntityController.confirmSO}" value="Confirm" rendered="#{salesOrderEntityController.confirmButton()==true}"/>
                    &nbsp;
                    <p:commandButton ajax="false" action="#{salesOrderEntityController.suspendSO}" value="Suspend" rendered="#{salesOrderEntityController.suspendEditButton()==true}"/>
                    <p:commandButton ajax="false" action="#{salesOrderEntityController.resumeSO}" value="Resume" rendered="#{salesOrderEntityController.resumeButton()==true}"/>
                    &nbsp;
                    <p:commandButton ajax="false" action="#{salesOrderEntityController.cancelSO}" value="Cancel" rendered="#{salesOrderEntityController.cancelButton()==true}"/>
                    <p:commandButton ajax="false" disabled="true" value="Cancelled" rendered="#{salesOrderEntityController.cancelButton()==false}"/>
                    <br />
                    <br />
                    <p:commandButton ajax="false" action="Edit" value="#{bundle.ViewSalesOrderEntityEditLink}" rendered="#{salesOrderEntityController.suspendEditButton()==true}"/>
                    <p:commandButton ajax="false" disabled="true" value="#{bundle.ViewSalesOrderEntityEditLink}" rendered="#{salesOrderEntityController.suspendEditButton()==false}"/>
                    &nbsp;
                    <p:commandButton ajax="false" action="#{salesOrderEntityController.destroyAndView}" value="Delete" rendered="#{loginBacking.deleteSalesOrder}"/>
                    &nbsp;
                    <p:commandButton ajax="false" action="#{salesOrderEntityController.prepareList}" value="Show All"/>
                    &nbsp;
                    <br />
                    <br />
                    <p:commandButton ajax="false" action="#{salesOrderEntityController.generateShippingOrders}" 
                                     value="Generate Shipping Orders" 
                                     disabled="#{!salesOrderEntityController.canRegenerateShippingOrders()}"
                                     rendered="#{shippingOrderEntityController.allShippingOrders.size()==0}"/>
                    <p:commandButton ajax="false" action="#{salesOrderEntityController.performCreditCheck}" value="Credit Check"
                                     rendered="#{salesOrderEntityController.needToPerformCreditCheck()}"/>
                    <br />
                    <br />
                    &nbsp;<p:commandLink ajax="false" action="ViewExpanded" value="Expanded View" />
                    &nbsp;<p:commandLink ajax="false" action="View" value="Brief View" />
                    <br />
                </h:form>
            </f:view>
        </ui:define>
    </ui:composition>

</html>
